import com.zaxxer.hikari.HikariDataSource;

import java.sql.Connection;
import java.sql.SQLException;

public class Demo01 {
    public static void main(String[] args) {
        HikariDataSource dataSource = new HikariDataSource();
        dataSource.setDriverClassName("com.mysql.jdbc.Driver");
        dataSource.setJdbcUrl("jdbc:mysql://localhost:3306/jdbc?serverTimezone=GMT%2B8");
        dataSource.setUsername("root");
        dataSource.setPassword("123456");
        dataSource.setMaximumPoolSize(10);
        dataSource.setMinimumIdle(5); //

        try {
            Connection connection = dataSource.getConnection();
            if (connection != null){
                System.out.println("连接成功");
            }else {
                System.out.println("连接失败");
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
